import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;


@ManagedBean
@SessionScoped
public class ThemeSwitcherBean {

   private Map<String, String> themes;
   private List<Theme> advancedThemes;
   private String theme;
   private GuestPreferences gp = new GuestPreferences();

   public void setGp(GuestPreferences gp) {
      this.gp = gp;
   }

   public Map<String, String> getThemes() {
      return themes;
   }

   public String getTheme() {
      return theme;
   }

   public void setTheme(String theme) {
      this.theme = theme;
   }

   @PostConstruct
   public void init() {   
      theme = gp.getTheme();
      
      advancedThemes = new ArrayList<Theme>();
      advancedThemes.add(new Theme("blitzer", "blitzer.png"));
      advancedThemes.add(new Theme("cruze", "cruze.png"));   
      advancedThemes.add(new Theme("test003", "test003.png")); 
   }

   public void saveTheme() {
      gp.setTheme(theme);
   }

   public List<Theme> getAdvancedThemes() {
      return advancedThemes;
   }
}
